package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.model.DeveloperModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.pro.domain.dao.DeveloperDao;
import com.xbongbong.pro.domain.entity.DeveloperEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2021/03/03 16:33
 */
@Service("developerModel")
public class DeveloperModelImpl implements DeveloperModel {

    @Resource
    private DeveloperDao developerDao;

    @Override
    public Integer insert(DeveloperEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return developerDao.insert(entity);
    }

    @Override
    public Integer update(DeveloperEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setUpdateTime(now);
        return developerDao.update(entity);
    }

    @Override
    public List<DeveloperEntity> findEntitys(Map<String, Object> param) {
        return developerDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return developerDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer deleteByKey(Long key, String corpid) {
        return developerDao.deleteByKey(key, corpid);
    }

    @Override
    public DeveloperEntity getByKey(Long key, String corpid) {
        return developerDao.getByKey(key, corpid);
    }
}
